home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #1 / Amiga Plus 1999 #1.iso / System-Boost / Workbench / BackClock / sources / utils.h < prev   
C/C++ Source or Header  |  1998-08-10  |  4KB  |  137 lines

  1. /* version 2.3
  2.  */
  3. #ifndef __UTILS_H
  4. #define __UTILS_H
  5.  
  6. #include <intuition/intuition.h>
  7. #include <devices/timer.h>
  8. #include <exec/ports.h>
  9. #include <dos/dos.h>
  10. #include <dos/dosextens.h>
  11. #include <libraries/notifyintuition.h>
  12. #include <workbench/startup.h>
  13.  
  14. #define ERRORNOMEM  1
  15. #define ERRORNOPORT 2
  16. #define ERRORUNKNOWNCMD 3
  17. #define OK         -1
  18.  
  19. #define TITLE      "BackClock V2.2ß4"
  20. #define MAXH       1000
  21.  
  22.  
  23. struct RGB {
  24.   UBYTE R,
  25.         G,
  26.         B,
  27.         pad ;
  28.   ULONG reg ;
  29. } ;
  30. #define NUM_COLORS 5
  31. #define COL_SEC    0
  32. #define COL_MIN    1
  33. #define COL_HEU    2
  34. #define COL_TIC    3
  35. #define COL_BAC     4
  36.  
  37. #define IDCMP IDCMP_CHANGEWINDOW|IDCMP_NEWSIZE
  38. #define WFLG  WFLG_BACKDROP|WFLG_BORDERLESS
  39. #define TXT_SCRTITLE "BackClock"
  40.  
  41. struct specWin {
  42.   ULONG posX ;
  43.   ULONG posY ;
  44.   ULONG width ;
  45.   ULONG height ;
  46.   struct RGB cmap[NUM_COLORS] ;  
  47.   UWORD  fill ;
  48. } ;
  49.  
  50. struct prjSt {
  51.   struct Window * win ;                   // remplit par OpenWindow()
  52.   struct DateStamp * date ;               // date au format interne
  53.   char   datestr[10] ;                                                                  // date au format ASCII
  54.   UBYTE  heu ;                                                                                          // heure
  55.   UBYTE  min ;                                                                                          // minute
  56.   UBYTE  sec ;                                                                                          // secondes
  57.   UBYTE  oldH ;                                                                                 // derniere heure affichée
  58.   UBYTE  oldM ;                                                                                 //     "     min      " 
  59.   UBYTE  oldS ;                                                                                 //     "     sec      " 
  60.   struct timerequest * treq ;                                                   // requete I/O timer.device
  61.   struct MsgPort     * trport ;                 // port rply timer
  62.   UBYTE  timerok ;                                                                           // ouverture timer ok
  63.   struct IntNotifyRequest * Notify ;            // requete notify
  64.   struct MsgPort          * notifyPort ;        // port reply notify
  65.   struct specWin backWin ;
  66.   ULONG  lastError ;
  67.   struct Screen * wb ;                          // lock to WB
  68.   struct RastPort * RP1 ;                       // tmp rp 1
  69.   struct RastPort * RP2 ;                       // tmp rp 2
  70. } ;
  71. struct backMsg {
  72.   struct Message execmsg ;
  73.   ULONG Class ; 
  74.   APTR  ptrPrj ; // pointeur sur prj à retourner lors d'un BC_GetPrj
  75.   LONG  error ;  // contient l'erreur de retour
  76. } ;
  77.  
  78. /* differentes classes
  79.  */
  80. #define BC_Quit          0x00000001 // recu demande d'arret externe
  81. #define BC_GetPrj        0x00000002 // recu l'envoi adresse prj
  82. #define BC_Refresh       0x00000003 // recu demande de rafraichissement
  83. #define BC_SaveConf      0x00000004 // reçu demande de sauvegarde prefs
  84. #define BC_UseConf       0x00000005 // reçu demande d'utiliser nouvelle prefs
  85. #define BC_SetWindow     0x00000006 // pos & taille window changées
  86. #define BC_RefreshColors 0x00000007 // colors changed
  87.  
  88. typedef prjSt idWin ;
  89.  
  90. // gadget systemes
  91. struct Gadget szgdg = {
  92.   NULL,
  93.   0,0, 100, 15,
  94.   GFLG_GADGHNONE,
  95.   GACT_RELVERIFY,
  96.   GTYP_WDRAGGING,
  97.   NULL,
  98.   NULL,
  99.   NULL,
  100.   NULL,
  101.   NULL,
  102.   10,
  103.   NULL
  104. } ;
  105. struct Gadget tagdg = {
  106.   NULL,
  107.   0,0, 0, 0,
  108.   GFLG_GADGHNONE,
  109.   GACT_RELVERIFY,
  110.   GTYP_SIZING,
  111.   NULL,
  112.   NULL,
  113.   NULL,
  114.   NULL,
  115.   NULL,
  116.   11,
  117.   NULL
  118. } ;
  119. ULONG top = NULL ;
  120.  
  121.  
  122. // proto  
  123. idWin * init(WBArg *) ;
  124. void close(idWin *) ;
  125. void getDate(idWin *) ;
  126. void writeDate(idWin *) ;
  127. extern void DateToByte(register __a0 char *, register __a1 idWin *) ;
  128. void initwin(idWin * prj) ;
  129. void processwin(idWin* prj) ;
  130. void effacer(idWin * prj) ;
  131. void retracer(idWin * prj) ;
  132. void runtimer(idWin * prj) ;
  133. void setArgs(idWin * prj, LONG * args) ;
  134. int exists() ;
  135. void ez_req(UBYTE *, UBYTE *, UBYTE *, APTR) ;
  136. #endif
  137.